﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Troschuetz.Random;

namespace TestNetwork
{
    class StaticScenario:Screnario
    {
        private int periodIncomingTime;

        public StaticScenario(int[,] D, int[] B, int timeUnit, int numberOfRequest, int periodIncomingTime)
            : base(D, B, timeUnit, numberOfRequest)
        {
            this.periodIncomingTime = periodIncomingTime;
        }

        public override void Generate()
        {
            FileStream file = new FileStream("static_request.txt", FileMode.Create);
            StreamWriter wr = new StreamWriter(file);

            StandardGenerator generator = new StandardGenerator();

            DiscreteUniformDistribution randomForB =
                new DiscreteUniformDistribution(generator);
            randomForB.Alpha = 0;
            randomForB.Beta = B.Length - 1;

            DiscreteUniformDistribution randomForD =
                new DiscreteUniformDistribution(generator);
            randomForD.Alpha = 0;
            randomForD.Beta = D.Length / 2 - 1;

            int d, b;

            int[] a = new int[4];

            for (int i = 0; i < numberOfRequest; i++)
            {
                d = randomForD.Next();
                b = randomForB.Next();

                a[b]++;

                Request req = new Request(i, D[d, 0], D[d, 1], B[b], periodIncomingTime * i, int.MaxValue);

                wr.WriteLine(req);
                Console.WriteLine(req);
            }

            foreach (var item in a)
            {
                Console.WriteLine(item);
            }

            wr.Close();
            file.Close();
        }
    }
}
